import request from "@/utils/request.ts";
import {Majority, MajorityInfo} from "@/api/types/majority.ts";


export const getAllMajority = () => {
    return request<MajorityInfo>(
        {
            method: 'GET',
            url: '/api/majority/get/all'
        }
    )
}

export const deleteMajority = (majority: Majority) => {
    return request<MajorityInfo>(
        {
            method: 'GET',
            url: '/api/majority/delete',
            params: {
                id: majority.id,
                name: majority.name
            }
        }
    )
}

export const addMajority = (newMajority: Majority) => {
    return request<MajorityInfo>(
        {
            method: 'POST',
            url: '/api/majority/add',
            headers: {
                'Content-Type': 'multipart/form-data'
            },
            data: {
                name: newMajority.name
            }
        }
    )
}

